import { create } from 'zustand';

interface PageInfo {
  name: string;
  ip: string;
  data: Record<string, any>;
  originBridgeKey: string;
  receiveName: string;
  status: 'online' | 'offline';
}

interface DisplayConfig {
  calledColor: string;
  receivedColor: string;
  showCalled: boolean;
  showReceived: boolean;
}

interface IStore {
  pages: PageInfo[];
  currentPage: PageInfo | null;
  socket: WebSocket | null;
  originWsMsg: string[];
  displayConfig: DisplayConfig;
  initPages: () => void;
  removePage: (name: string) => void;
}

export const useStore = create<IStore>((set, get) => ({
  pages: [],
  currentPage: null,
  socket: null,
  originWsMsg: [],
  displayConfig: {
    calledColor: 'blue',
    receivedColor: 'yellow',
    showCalled: true,
    showReceived: true,
  },
  initPages: () => {},
  removePage: (name: string) => {
    console.log(name);
  },
}));
